import java.util.Scanner;

public class Solution1 {
    //https://leetcode.cn/problems/number-of-segments-in-a-string/
    //统计字符串中的单词个数
        public int countSegments(String s) {
            int count = 0;
            String[] str = s.split(" ");
            for(int i = 0;i < str.length;i++) {
                if(!str[i].equals("")) {
                    count++;
                }
            }
            return count;
        }

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String s = scanner.nextLine();
        Solution1 solution1 = new Solution1();
        System.out.println(solution1.countSegments(s));
    }
}
